﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace MyVideoTek
{
    class GestionDossierFichier
    {
        public string ClearMovieName(string unFilm)
        {
            unFilm = unFilm.ToUpper();

            unFilm = unFilm.Replace("DVDRIP", null);
            unFilm = unFilm.Replace("BDRIP", null);
            unFilm = unFilm.Replace("XVID", null);
            unFilm = unFilm.Replace("RIP", null);

            unFilm = unFilm.Replace("[", null);
            unFilm = unFilm.Replace("]", null);

            unFilm = unFilm.Replace("EMULE", null);

            unFilm = unFilm.Replace(".", null);
            unFilm = unFilm.Replace("By", null);

            unFilm = unFilm.Replace("-", " ");
            unFilm = unFilm.Replace("_", " ");

            unFilm = unFilm.Replace("FRENCH", null);
            unFilm = unFilm.Replace("VOSTFR", null);
            unFilm = unFilm.Replace("VOST", null);
            unFilm = unFilm.Replace("VF", null);
           

            unFilm = Regex.Replace(unFilm, "(_)", " ");

            string dateFilm;
             dateFilm = unFilm.Substring(unFilm.Length - 5, 4);

            //S'il y a une date après le titre du film
            if (Regex.Match(dateFilm, "[0-9]").Success)
            {
                //Suppression de la date
                unFilm = unFilm.Substring(0, unFilm.Length - (dateFilm.Length + 2));
            }
  
            //Retourne le nom du film tout beau tout propre lolzje pète un plomb ENKULER D'RIRE LES REGEX
            return unFilm;
        }
    }
}
